﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using dogd;

namespace Pibby.Core.Persistence
{
	/// <summary>
	/// Wrapper around System.Version to allow for persistence.
	/// </summary>
	[Table("Version")]
	public class ApplicationVersion
	{
		public ApplicationVersion()
		{
		}

		public ApplicationVersion(System.Version v)
		{
			this.Major = v.Major;
			this.Minor = v.Minor;
			this.Build = v.Build;
			this.Revision = v.Revision;
		}

		[IntegerColumn("Major")]
		public int Major
		{
			get;
			set;
		}

		[IntegerColumn("Minor")]
		public int Minor
		{
			get;
			set;
		}

		[IntegerColumn("Build")]
		public int Build
		{
			get;
			set;
		}

		[IntegerColumn("Revision")]
		public int Revision
		{
			get;
			set;
		}

		public System.Version Version
		{
			get
			{
				return new System.Version(this.Major, this.Minor, this.Build, this.Revision);
			}

			set
			{
				if (value != null)
				{
					this.Major = value.Major;
					this.Minor = value.Minor;
					this.Build = value.Build;
					this.Revision = value.Revision;
				}
			}
		}

	}
}
